#pragma once

#include <gofcl_usbfs_r.h>

typedef struct {
	u32_s DS : 2;
	u32_s NZLSOH : 1;
	u32_s : 1;
	u32_s DAR : 7;
	u32_s EOPFT : 2;
	u32_s : 19;
} usbfs_dcfg_s;

_Static_assert(sizeof(usbfs_dcfg_s) == 4, "Struct usbfs_dcfg_s defined error!");

static inline void usbfs_wreg_dcfg_s(usbfs_dcfg_s dcfg) {
	union {
		usbfs_dcfg_s d;
		u32_s u;
	} du = {
		.d = dcfg,
	};
	usbfs_wreg(USBFS_DCFG_R, du.u);
}

static inline usbfs_dcfg_s usbfs_rreg_dcfg_s(void) {
	union {
		usbfs_dcfg_s d;
		u32_s u;
	} gu = {
		.u = usbfs_rreg(USBFS_DCFG_R),
	};
	return gu.d;
}
